﻿#include <stdio.h>
#include "Hello.h"
#include <windows.h>

int main()
{
	// define functional pointer
	void(*p_say_hello)(char const *) = NULL;

	// load dll file, require window.h file
	HMODULE module = LoadLibraryA("hello.dll");
	if (module == NULL) {
		system("error load");
	}

	p_say_hello = (void(*)(char const *))GetProcAddress(module, "say_hello");
	if (p_say_hello != NULL) {
		p_say_hello("John");
	}
	else {
		system("function p_hello can not excute");
	}

	FreeLibrary(module);
	system("pause");
	return 0;
}

